import { EventService } from './../../../shared/service/event.service';
import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'app-signing-pay',
  templateUrl: './signing-pay.component.html',
  styleUrls: ['./signing-pay.component.scss'],
})
export class SigningPayComponent implements OnInit {
  @Input() tagData: any;
  payMoney: any;
  constructor(
    private eventService: EventService
  ) { }

  ngOnInit() {
    if (this.eventService.eventEmit.listenerCount('payMoney') > 0) {
      this.eventService.eventEmit.removeListener('payMoney');
    }
    this.eventService.eventEmit.on('payMoney' , money => {
      console.log('payMoney change');
      this.payMoney = money;
    });
  }
  submit(item) {
    console.log('submit');
    this.eventService.eventEmit.emit('submit' , item);
  }
}
